<template>
  <div class="pagination">
    <el-pagination
      @current-change="handleCurrentChange"
      layout="prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
import api from "@/api";
export default {
  data() {
    return {
      total: 0,
    };
  },
  mounted() {
    api.paramsTotal().then((res) => {
      this.total = res.data.result[0]["count(*)"];
    }).catch(error => {
        console.log(error);
    });
  },
  methods: {
    handleCurrentChange(val) { 
      this.$bus.$emit("onPage", val);
    },
  },
};
</script>

<style scoped>
.pagination {
  margin-top: 30px;
}
</style>